package com.xd.core.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.xd.core.company.entity.TowBindBank;
import com.xd.core.company.mapper.TowBindBankMapper;
import com.xd.core.company.service.ITowBindBankService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 通道二提现账户白名单 服务实现类
 * </p>
 *
 * @author ZX
 * @since 2025-06-20
 */
@Service
public class TowBindBankServiceImpl extends ServiceImpl<TowBindBankMapper, TowBindBank> implements ITowBindBankService {

    @Autowired
    private  TowBindBankMapper towBindBankMapper;
    @Override
    public void add(TowBindBank towBindBank) {
        TowBindBank old = towBindBankMapper.selectOne(new LambdaQueryWrapper<TowBindBank>().eq(TowBindBank::getAccNo, towBindBank.getAccNo()));
        if (old != null)
            throw new RuntimeException("卡号已绑定");
        towBindBankMapper.insert(towBindBank);
    }
}
